﻿

using Csla;
using Csla.Data;
using System;
using System.Linq;

namespace Kiosk.Library
{
	#region CellProvider
	[Serializable()]
	public partial class CellProviderReadOnlyList : ReadOnlyListBase<CellProviderReadOnlyList, CellProviderInfo>
	{
		#region FactoryMethods
		private CellProviderReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static CellProviderReadOnlyList GetAll()
		{
			return DataPortal.Fetch<CellProviderReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.CellProvider
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new CellProviderInfo(d.CellProviderID, d.Name, d.SmsGateway));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region Employee
	[Serializable()]
	public partial class EmployeeReadOnlyList : ReadOnlyListBase<EmployeeReadOnlyList, EmployeeInfo>
	{
		#region FactoryMethods
		private EmployeeReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static EmployeeReadOnlyList GetAll()
		{
			return DataPortal.Fetch<EmployeeReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.Employee
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new EmployeeInfo(d.EmployeeID, d.DomainName, d.FirstName, d.LastName, d.LocationID, d.Email, d.OfficePhone, d.CellPhone, d.CellProviderID));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region Icon
	[Serializable()]
	public partial class IconReadOnlyList : ReadOnlyListBase<IconReadOnlyList, IconInfo>
	{
		#region FactoryMethods
		private IconReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static IconReadOnlyList GetAll()
		{
			return DataPortal.Fetch<IconReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.Icon
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new IconInfo(d.IconID, d.IconFile, d.IconKeyword));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region Location
	[Serializable()]
	public partial class LocationReadOnlyList : ReadOnlyListBase<LocationReadOnlyList, LocationInfo>
	{
		#region FactoryMethods
		private LocationReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static LocationReadOnlyList GetAll()
		{
			return DataPortal.Fetch<LocationReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.Location
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new LocationInfo(d.LocationID, d.Name, d.XCoordinate, d.YCoordinate));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region Notification
	[Serializable()]
	public partial class NotificationReadOnlyList : ReadOnlyListBase<NotificationReadOnlyList, NotificationInfo>
	{
		#region FactoryMethods
		private NotificationReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static NotificationReadOnlyList GetAll()
		{
			return DataPortal.Fetch<NotificationReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.Notification
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new NotificationInfo(d.NotificationID, d.NotificationTypeID, d.LocationID, d.EmployeeID, d.NotificationDate, d.Title, d.Description));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region NotificationType
	[Serializable()]
	public partial class NotificationTypeReadOnlyList : ReadOnlyListBase<NotificationTypeReadOnlyList, NotificationTypeInfo>
	{
		#region FactoryMethods
		private NotificationTypeReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static NotificationTypeReadOnlyList GetAll()
		{
			return DataPortal.Fetch<NotificationTypeReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.NotificationType
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new NotificationTypeInfo(d.NotificationTypeID, d.Name));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region Presentation
	[Serializable()]
	public partial class PresentationReadOnlyList : ReadOnlyListBase<PresentationReadOnlyList, PresentationInfo>
	{
		#region FactoryMethods
		private PresentationReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static PresentationReadOnlyList GetAll()
		{
			return DataPortal.Fetch<PresentationReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.Presentation
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new PresentationInfo(d.PresentationID, d.PresentationTypeID, d.PresentationStatusID, d.Name));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region PresentationStatus
	[Serializable()]
	public partial class PresentationStatusReadOnlyList : ReadOnlyListBase<PresentationStatusReadOnlyList, PresentationStatusInfo>
	{
		#region FactoryMethods
		private PresentationStatusReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static PresentationStatusReadOnlyList GetAll()
		{
			return DataPortal.Fetch<PresentationStatusReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.PresentationStatus
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new PresentationStatusInfo(d.PresentationStatusID, d.Name));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region PresentationType
	[Serializable()]
	public partial class PresentationTypeReadOnlyList : ReadOnlyListBase<PresentationTypeReadOnlyList, PresentationTypeInfo>
	{
		#region FactoryMethods
		private PresentationTypeReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static PresentationTypeReadOnlyList GetAll()
		{
			return DataPortal.Fetch<PresentationTypeReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.PresentationType
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new PresentationTypeInfo(d.PresentationTypeID, d.Name));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
	#region Slide
	[Serializable()]
	public partial class SlideReadOnlyList : ReadOnlyListBase<SlideReadOnlyList, SlideInfo>
	{
		#region FactoryMethods
		private SlideReadOnlyList()
		{
		  // require use of factory methods
		}
		
	    public static SlideReadOnlyList GetAll()
		{
			return DataPortal.Fetch<SlideReadOnlyList>();
		}	
		
		#endregion
		
		#region  Data Access

		private void DataPortal_Fetch()
		{
		  // fetch with no filter
		  FetchAll();
		}

		private void FetchAll()
		{
		  RaiseListChangedEvents = false;
		  using (var ctx = ContextManager<Kiosk.Data.KioskDataContext>.GetManager(Database.ConnectionString))
		  {
			var data = from o in ctx.DataContext.Slide
					   select o;
			IsReadOnly = false;
			foreach (var d in data)
			  this.Add(new SlideInfo(d.SlideID, d.PresentationID, d.Title, d.Location, d.Order));
			IsReadOnly = true;
		  }
		  RaiseListChangedEvents = true;
		}
		#endregion
	}
	#endregion
	
}

